package com.xjrsoft.module.customerTwo.aiplm.t_aiplm_design.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xjrsoft.core.tool.utils.StringUtil;
import com.xjrsoft.module.customerTwo.aiplm.t_aiplm_design.entity.TAiplmDesign;
import com.xjrsoft.module.customerTwo.aiplm.t_aiplm_design.dto.TAiplmDesignListDto;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.xjrsoft.common.page.ConventPage;
import com.xjrsoft.common.page.PageOutput;
import java.util.List;
import com.xjrsoft.module.customerTwo.aiplm.t_aiplm_design.mapper.TAiplmDesignMapper;
import com.xjrsoft.module.customerTwo.aiplm.t_aiplm_design.service.ITAiplmDesignService;
import com.xjrsoft.core.mp.base.BaseService;
import com.xjrsoft.core.tool.utils.Func;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;

/**
 *  服务实现类
 *
 * @author dongxinhang
 * @since 2024-07-08
 */
@Service
@AllArgsConstructor
public class TAiplmDesignServiceImpl extends BaseService<TAiplmDesignMapper, TAiplmDesign> implements ITAiplmDesignService {


	@Override
	public IPage<TAiplmDesign> getPageList(TAiplmDesignListDto pageListDto) {
		Wrapper<TAiplmDesign> wrapper = Wrappers.<TAiplmDesign>query().lambda()
				.like(!StringUtil.isEmpty(pageListDto.getF_KeyWork()), TAiplmDesign::getFKeywork, pageListDto.getF_KeyWork());
		return this.page(ConventPage.getPage(pageListDto), wrapper);
	}

	@Override
	public boolean addTAiplmDesign(TAiplmDesign tAiplmDesign) {
		boolean isSuccess = this.save(tAiplmDesign);
		return isSuccess;
	}

	@Override
	public boolean updateTAiplmDesign(String id, TAiplmDesign tAiplmDesign) {
		tAiplmDesign.setFId(id);
		return this.updateById(tAiplmDesign);
	}

	public boolean delete(String ids) {
		List<String> idList = Func.toStrList(ids);
		if (this.removeByIds(idList)) {
			return true;
		}
		return false;
	}

	@Override
	public IPage<TAiplmDesign> queryPage(Page page, TAiplmDesignListDto dto) {
		return this.getBaseMapper().queryPage(page,dto);
	}

}